<?php
$yqrid = $_POST['yqrid'];
$name = $_POST['name'];
$api_type = $_POST['api_type'];
$productType = $_POST['productType'];
$goodsCode = $_POST['goodsCode'];
$sku = $_POST['sku'];
$se_num = $_POST['se_num'];
$downtel = $_POST['downtel'];
$jieshao = $_POST['jieshao'];
$yys = $_POST['yys'];
$ltime = $_POST['ltime'];
$zhutu = $_POST['zhutu'];
$link = $_POST['link'];
$price = $_POST['price'];
$proxy_price = $_POST['proxy_price'];
$notes = $_POST['notes'];
$xuanhao = $_POST['xuanhao'];
$baoyou = $_POST['baoyou'];
$gsd = $_POST['gsd'];
$other = $_POST['other'];

$haokaid = ''; // 初始化$haokaid变量

if ($api_type === 'yqrapi') {
  $haokaid = $yqrid;
} elseif ($api_type === 'hnhklt') {
  $haokaid = $productType;
}elseif ($api_type === 'haokeyun') {
  $haokaid = $goodsCode;
}elseif ($api_type === 'gantanhao') {
  $haokaid = $suk;
}

include_once("../../untils/conn.php");
if ($con) {
    mysqli_query($con, "set names utf8");
    $data = mysqli_query($con, "INSERT INTO list (haokaid, name, jieshao, zhutu, ltime, yys, link, price, proxy_price, notes, xuanhao, other, baoyou,gsd, api_type, se_num , downtel) VALUES ('$haokaid', '$name', '$jieshao', '$zhutu', '$ltime', '$yys', '$link', '$price', '$proxy_price', '$notes', '$xuanhao', '$other', '$baoyou','$gsd', '$api_type', '$se_num', '$downtel')");
    if ($data) {
        echo ("<script>alert('添加信息成功')</script>");
        echo ("<script>window.location.href='../list.php'</script>");
    } else {
        echo ("<script>alert('添加失败,请输入全部数据');history.back();</script>");
        // echo "Error updating record: " . $con->error;
    }
}
